import 'package:flutter_test/flutter_test.dart';
import 'package:component_db/component_db.dart';
import 'package:component_db/component_db_platform_interface.dart';
import 'package:component_db/component_db_method_channel.dart';
import 'package:plugin_platform_interface/plugin_platform_interface.dart';

class MockComponentDbPlatform
    with MockPlatformInterfaceMixin
    implements ComponentDbPlatform {

  @override
  Future<String?> getPlatformVersion() => Future.value('42');
}

void main() {
  final ComponentDbPlatform initialPlatform = ComponentDbPlatform.instance;

  test('$MethodChannelComponentDb is the default instance', () {
    expect(initialPlatform, isInstanceOf<MethodChannelComponentDb>());
  });

  test('getPlatformVersion', () async {
    ComponentDb componentDbPlugin = ComponentDb();
    MockComponentDbPlatform fakePlatform = MockComponentDbPlatform();
    ComponentDbPlatform.instance = fakePlatform;

    expect(await componentDbPlugin.getPlatformVersion(), '42');
  });
}
